<template>
	<view class="newIndex" :style="{'height':screenHei+'vh'}">
		<view class="top-bg">
			<view class="wrap">
				<view class="index-top">
					<view class="">
						<image class="icon" src="/static/index/icon.png"></image>
						<text class="txt" style="font-family: Kaiti, 楷体-简;letter-spacing: -2px;">
							助业业主
							<!-- <text style="color: #e3e3e7;margin-left: 6rpx;font-size: 15px;"> ({{projectItem.proName}})</text> -->
						</text>
						<text style="color: #e3e3e7;margin-left: 6rpx;font-size: 15px;" v-show="projectItem.proName">
							({{projectItem.proName}})</text>
					</view>
					<view v-show="projectItem.proName">
						<image @click="changeHead" style="width: 29px;height: 23px;"
							src="../../static/index/change.png">
						</image>
					</view>

				</view>




				<view class="noticeWrap">
					<view class="notice">
						<!-- 	<view class="notice-horn" @click="noticeListFun">
							<view class="circle" v-if="!isNotice"></view>
							<image  class="horn" src="../../static/index/notice.png"></image> -->
						<view class="notice-horn" @click="noticeListFun">
							<!-- {{isNotice}}{{noticePoint}} -->
							<view class="circle" v-if="noticePoint>0"></view>
							<image class="horn" src="../../static/index/notice.png"></image>
							<text class="scroll-txt">
								<u-notice-bar v-if="noticeList" :volume-icon="false" type="success" :list="noticeList">
								</u-notice-bar>
								<u-notice-bar v-else :volume-icon="false" type="success" :list="['暂无通知']">
								</u-notice-bar>
							</text>
						</view>
					</view>
					<view class="" @click="scanFun">
						<image style="width: 70rpx;height:70rpx;" src="../../static/index/saoma.png"></image>
					</view>
				</view>

				<swiper style='margin: 14rpx 0 0 0;' :indicator-dots="true" height="190" :autoplay="true"
					:interval="5000" :duration="1000" circular>
					<swiper-item v-for="(item,index) in swiperList" :key='index'>
						<view class="swiper-item" @click="toLink(index) ">
							<image mode="widthFix" class='swiper_img' style="width: 100%;border-radius: 16rpx;"
								:src="item.image" />
						</view>
					</swiper-item>
				</swiper>
				<view style="padding-bottom:100rpx">
					<view v-for="(item,index) in itemList" :key="index" :style="index==0?'':'margin-top: 80rpx;'">
						<view :style="{'marginBottom':(index+1 == itemList.length?'10rpx':'')}">
							<!-- 日常 -->
							<view class="item" v-if="item.id == 1">
								<view class="title">{{ item.name }}
									<span class="red"
										v-if="insuranTotal+renovation+repairsState+lawsuitRecord+openDoor+monitoring>0">
										{{insuranTotal+renovation+repairsState+lawsuitRecord+openDoor+monitoring>99?"99+":insuranTotal+renovation+repairsState+lawsuitRecord+openDoor+monitoring}}

									</span>

								</view>
								<view class="more" @click="moreItem(item.id)">
									更多
									<image style="margin-left: 14rpx;" class="more-img" src="../../static/index/gd.png">
									</image>
								</view>
							</view>
							<!-- 公告和缴费 -->
							<view class="item" v-else style="margin-top: -14px;">
								<view class="title">
									{{ item.name }}
									<!-- <span class="red" v-if="item.id==2 && noticePoint+voteRedsTotal>0">
										{{noticePoint+voteRedsTotal>99?"99+":voteRedsTotal+noticePoint}}
									</span> -->
									<span class="red" v-if="item.id==2 && noticePoint>0">
										{{noticePoint>99?"99+":noticePoint}}
									</span>
									<span class="" v-if="item.id==3 &&num>0 "
										style="position: absolute;top: 0;width: 20rpx;height: 20rpx;border-radius: 10rpx;background-color: #FF3B30;">
									</span>
								</view>
								<view class="more" @click="moreItem(item.id)">
									更多
									<image style="margin-left: 14rpx;" class="more-img" src="../../static/index/gd.png">
									</image>
								</view>
							</view>
							<view class="application shadow">
								<view class="block">
									<view class="app" style="position: relative;" @click='tapName(item1)'
										v-for="(item1,index1) in item.project" :key="index1+10">
										<image class="app-img" :src="item1.img"></image>
										<!-- 日常操作 -->
										<text class="circle1"
											v-if="item1.id==31 && repairsState>0">{{repairsState}}</text>
										<text class="circle1" v-if="item1.id==32 &&renovation > 0">{{renovation}}</text>
										<text class="circle1" v-if="item1.id==33 &&openDoor > 0">{{openDoor}}</text>
										<text class="circle1" v-if="item1.id==34 &&monitoring > 0">{{monitoring}}</text>
										<text class="circle1"
											v-if="item1.id==35 &&insuranTotal > 0">{{insuranTotal}}</text>
										<text class="circle1"
											v-if="item1.id==37 &&lawsuitRecord > 0">{{lawsuitRecord}}</text>


										<!-- 工作公示 -->
										<text class="circle1" v-if="item1.id==21&&noticePoint >0">{{noticePoint}}</text>
										<!-- 	<text class="red_min"   v-if="publicity"> {{publicity}} </text> -->
										<!-- <text class="red_min publicity" v-if="item1.id==22 && publicity"> {{publicity }}
										</text> -->
										<!-- <text class="circle1" v-if="item1.id==22 && publicity"> {{publicity }}</text> -->
										<text class="red_min" v-if="item1.id==22 && publicity"> </text>
										<text class="circle1"
											v-if="item1.id==30 &&voteRedsTotal>0">{{voteRedsTotal}}</text>

										<view class="txt">{{ item1.name }}</view>
										<!--                  缴费红点-->
										<!-- 物业费 -->
										<text :class="item1.id==11 && propertyFees ==0 ?'red_min':''"
											v-if="item1.id==11 && propertyFees ==0 "></text>
										<!-- 水费 -->
										<text :class="item1.id==12 && water ==0 ?'red_min':''"
											v-if="item1.id==12 && water ==0"></text>
										<!-- 车位费 -->
										<text :class="item1.id==13 &&parkingSpaceFees ==0?'red_min':''"
											v-if="item1.id==13 &&parkingSpaceFees ==0"></text>
										<!-- 维修费 -->
										<text :class="item1.id==14 &&repairFees ==0?'red_min':''"
											v-if="item1.id==14 &&repairFees ==0"></text>
										<!-- 暖气费 -->
										<text :class="item1.id==15 &&heatingCosts ==0?'red_min':''"
											v-if="item1.id==15 &&heatingCosts ==0"></text>
										<!-- 制冷费 -->
										<text :class="item1.id==16 &&refrigerationCharges ==0?'red_min':''"
											v-if="item1.id==16 &&refrigerationCharges ==0"></text>
										<!-- 电费 -->
										<text :class="item1.id==17 &&electricity ==0?'red_min':''"
											v-if="item1.id==17 &&electricity ==0"></text>
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>

		<view v-if="modalShow">
			<view class="modal-bg" @click="modalShow = false"></view>
			<view class="modal-cont">
				<view class="modal-text" @click="handlerAdd(item)" v-for="(item, index) in hourseList" :key="index"
					:name='index'>{{item.proName}}</view>
				<view class="modal-cancel" @click="modalShow = false">取消</view>
			</view>
		</view>

		<!-- 开始附议弹框 -->

		<uni-popup ref="popup" background-color="#fff">
			<view class="meeting-dialog">
				<view class="meeting-wrap">
					<view class="meeting-title">
						{{voteData.community_name}}
						{{voteData.vote_type == 1 ? '首次成立业主大会申请附议'
						 : voteData.vote_type == 2 ? '解聘物业临时业主大会申请'
						                          : '选聘物业公司业主大会附议'
												}}
					</view>
					<view class="meeting-start">
						尊敬的{{projectItem.ownerName}}业主
					</view>
					<view class="meeting-cont">
						{{voteData.community_name}}
						{{voteData.vote_type == 1 ? '首次成立业主大会申请附议'
						 : voteData.vote_type == 2 ? '解聘物业临时业主大会申请'
						                          : '选聘物业公司业主大会附议'
												}}
						已开启附议投票，您可以在投票模块进行附议。
					</view>
					<view class="meeting-start">
						{{voteData.begin_time}}
					</view>
					<view class="meeting-start">
						发起人（{{voteData.full_name}}{{voteData.building_number}}）
					</view>
					<view class="meeting-start">
						联系电话：{{voteData.telephone}}
					</view>
					<view class="meeting-btn" @click="goFy">
						去附议
					</view>
				</view>
			</view>
		</uni-popup>
		<!-- 紧急通知 -->
		<view id="inform">
			<u-popup :mask-close-able="false" v-for="(item,index) in notifyList" :key="index" v-model="item.popUp"
				mode="center" border-radius='10' width='300px'>
				<view
					style="background: #ffffff;padding: 20px 20px;width: 550rpx; box-shadow: 0 1px 4px rgba(0,0,0,0.1),0 0 20px rgba(0,0,0,0.1) inset;">
					<view style="color:#fff;font-size: 14rpx;display:flex;flex-direction:row-reverse;">
						<!-- <view v-if="item.type=='1'"
							style="text-align: center; width:70px;padding: 5px 3px;background: #f90;border-top-left-radius: 10px;border-bottom-right-radius: 10px;">
							通知公告</view> -->
						<view v-if="item.type=='1'" class="title_header">
							<u-icon name="error" color="red" style="font-weight: 700;" size="34"></u-icon>

							紧急通知公告
						</view>
						<!-- <view v-if="item.type=='2'"
							style="text-align: center; width:70px;padding: 5px 3px;background: #19be6b;border-top-left-radius: 10px;border-bottom-right-radius: 10px;">
							规章制度</view> -->
						<view v-if="item.type=='2'" class="title_header">
							规章制度</view>
					</view>
					<view style="text-align: center;margin-bottom: 10px;margin-top: 0px;">
						<h3>{{item.name}}</h3>
					</view>
					<view class="" style="margin-bottom: 20rpx;font-size: 28rpx; color: #999;">
						发布时间：
						<text style="color: #000;">{{item.begin_time?item.begin_time.substring(0,16):''}}</text>
					</view>
					<view class="" style="margin-bottom: 20rpx;font-size: 28rpx; color: #999;">
						发布单位：
						<text style="color: #000;">{{item.org_name}}</text>
					</view>
					<view style="margin-bottom: 20px;text-align: center; font-size: 30rpx;" v-html="item.content">
					</view>
					<!-- 	<view style="margin-bottom: 20px;text-align: center;">
						{{item.content}}{{item.content}}{{item.content}}{{item.content}}</view> -->
					<view style="padding: 0 40px;">
						<u-button size='mini'
							style="background:linear-gradient(180deg, #76D904 0%, #417505 100%);color:#fff;height:66rpx;line-height: 66rpx;font-size: 28rpx;"
							shape="circle" @click="haveRead(item)">我已阅读</u-button>
					</view>

				</view>

			</u-popup>
		</view>
	</view>
</template>
<script>
	// import {
	// 	a
	// } from '@/utils/checkUpdater';
	import {
		log
	} from '../../js_sdk/hhyang-uni-simple-router/helpers/warn';
	import {getPostTokenFn} from '@/utils/utils.js'
	export default {
		data() {
			return {
				current: 1,
				modalShow: false,
				isDown: false, //是否显示下载按钮
				housingFlag: false,
				hourseList: null,
				hourseStr: null,
				hourseNum: 0, //选择第几个房间,
				bol: false, //弹窗
				PopupList: [],
				index: 0,
				projectItem: {},
				title: '素胚勾勒出青花，笔锋浓转淡',
				subTitle: '2020-05-15',
				thumb: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg',
				show: false,

				voteRedsTotal: null, //投票红点

				swiperList: [{
						index: 1,
						image: 'http://clhy-img.oss-cn-beijing.aliyuncs.com/venusImage/2021-12-15/1639571200709.png',
					},
					{
						index: 2,
						image: '../../static/image/zhuye1.png',
					},
					{
						index: 3,
						image: '../../static/image/img1.png',
					}
				],
				annouArr: [],
				noticeList: [],
				datalist: [],
				//text1: 'uView UI众多组件覆盖开发过程的各个需求，组件功能丰富，多端兼容。让您快速集成，开箱即用'
				text1: '足协杯战线连续第2年上演广州德比战，上赛',
				itemList: [{
						id: 1,
						name: '日常操作',
						project: [

							{
								id: 31,
								name: '报修',
								img: '../../static/index/bx.png',
								link: '/pages/guarantee/repairList'
							},
							{
								id: 32,
								name: '装修管理',
								img: '../../static/index/zzgl.png',
								link: '/pages/renovation/renovationindex'
							},
							{
								id: 35,
								name: '保险理赔',
								img: '../../static/index/bxlp.png',
								link: '/pages/yeInsurance/indexlnsurance'
							},
							{
								id: 37,
								name: '诉讼记录',
								img: '../../static/index/ss.png',
								link: '/pages/user/litigationIndex'
							},
							{
								id: 33,
								name: '开门',
								img: '../../static/index/km.png',
								// link:'/pages/index/saoma'
							},
							{
								id: 34,
								name: '监控查询',
								img: '../../static/index/jkgl.png'
							},
						]
					},

					{
						id: 2,
						name: '公告公示',
						project: [{
								id: 21,
								name: '通知公告',
								img: '../../static/index/tzgg.png',
								link: '/pages/authentication/newNoticeList'
							},
							{
								id: 22,
								name: '工作公示',
								img: '../../static/index/gggs.png',
								link: '/pages/publicity/publicity'
							},
							{
								id: 23,
								name: '财务公示',
								img: '../../static/index/gwgs.png',
								link: '/pages/finance/finance'
							},
							{
								id: 36,
								name: '设施维护',
								img: '../../static/index/weixiu.png',
								link: '/pages/equipmentMaintenance/equipmentMaintenanceList'
							},

							{
								id: 24,
								name: '小区资料',
								img: '../../static/index/xqzl.png',
								link: '/pages/community/communityindex'
							},
							{
								id: 25,
								name: '失物招领',
								img: '../../static/index/swzl.png',
								link: '/pages/lostarticle/lostarticle'
							},
							{
								id: 26,
								name: '制度流程',
								img: '../../static/index/lc.png',
								link: '/pages/technological/process'
							},
							{
								id: 27,
								name: '物业合同',
								img: '../../static/index/contract.png',
								link: '/pages/contract/contractindex?project_id=' + uni.getStorageSync(
									'projectItem').proId
							},
							{
								id: 28,
								name: '小区员工',
								img: '../../static/index/xqyg.png',
								link: '/pages/personnel/personnelindex'
							},
							// 不能删后期要用
							// {
							// 	id: 30,
							// 	name: '表决平台',
							// 	img: '../../static/vote/vote_icon.png',
							// 	link: '/pages/vote/voteList'
							// },
							// 不能删后期要用
						]
					},

					{
						id: 3,
						name: '物业缴费',
						project: [{
								id: 11,
								index: 1,
								name: '物业费',
								img: '../../static/index/wyf.png',
								link: '/pages/wuyepay/wuyepay'
							},

							{
								id: 13,
								index: 3,
								name: '车位费',
								img: '../../static/index/cwf.png',
								link: '/pages/pay/parking'
							},
							{
								id: 14,
								index: 4,
								name: '维修费',
								img: '../../static/index/wxf.png',
								link: '/pages/repairList/repairList'
							},
							{
								id: 15,
								index: 5,
								name: '暖气费',
								img: '../../static/index/nqf.png',
								link: '/pages/heating/heatingpay?type=' + 1
							},
							{
								id: 16,
								index: 6,
								name: '制冷费',
								img: '../../static/index/zlf.png',
								link: '/pages/heating/heatingpay?type=' + 2
							},
							{
								id: 12,
								index: 2,
								count: 0,
								name: '水费',
								img: '../../static/index/sdf.png',
								link: '/pages/forwater/forWater'
							},
							{
								id: 17,
								index: 7,
								name: '电费',
								img: '../../static/index/df.png',
								link: '/pages/forwater/forElectricity'
							},
							// {
							// 	id: 18,
							// 	index: 7,
							// 	name: '开票设置',
							// 	img: '../../static/index/df.png',
							// 	link: '/pages/invoice/invoiceIndex'
							// },
						]
					},
				],
				isNotice: false,
				// 红点数字
				noticePoint: '', //通知公告

				announcement: uni.getStorageSync('announcement') || true, //工作公示
				indexPoint: '', //底部首页
				msgPoint: '', //底部消息

				propertyFees: null, //物业费
				water: null, //水费
				parkingSpaceFees: null, //车位
				repairFees: null, //报修
				heatingCosts: null, //制热
				refrigerationCharges: null, //制冷
				electricity: null, //电
				// 日常操作
				insuranTotal: null, //保险理赔
				renovation: null, //装修管理
				repairsState: null, //报修
				lawsuitRecord: null, //诉讼
				openDoor: null, //开门
				monitoring: null, //监控
				publicity: '', //工作公示

				room_id: null, //所处房间id
				user_id: null, //操作人userId

				isMeeting: true, //是否附议弹框
				id: null,
				voteData: {},
				voteState: false,
				pro_id: null,
				info: {},
				notifyList: [],
				num: null,
				screenHei: 100,
				myPosition: null
			}
		},

		created() {
			let hei = uni.getSystemInfoSync().windowHeight;
			console.log("hei", hei);
			if (hei < 650) {
				this.screenHei = 120
			} else if (hei < 750) {
				this.screenHei = 103;
			}
			// a()
			//刚进入app时发送的信号
			uni.$on("getOwnerAppRedDotsInfo", () => {
				console.log("我接收到的信号是，getOwnerAppRedDotsInfo");
				this.getReddot()
			})
			// 进入私信是发送的信号
			uni.$on("getUserList", () => {
				console.log("我接收到的信号是，getUserList");
				this.getReddot()
			})
		},
		onShow() {
			if (uni.getStorageSync('announcement') !== '') {
				this.announcement = uni.getStorageSync('announcement')
			}
			console.log('getStorageSync', uni.getStorageSync('announcement'), 'aa', this.announcement)
			//判断是否登录
			if (uni.getStorageSync('loginFlag')) {
				this.getHouseList()
			}
			this.checkBaseInfo(); //检查基本参数赋值
			this.hourseNum = uni.getStorageSync('hourseNum') || 0
			this.hourseList = uni.getStorageSync('hourseList')
			this.housingFlag = false
			this.autoTime();
			this.getannouData();
			this.getNewNotice();
			this.user_id = uni.getStorageSync('rawData').userId;
			//获取项目id
			this.pro_id = uni.getStorageSync('projectItem').proId
			//获取投票红点
			this.getVoteDots()
			this.popupNotification()
			//this.getVoteList("322");
			// #ifdef APP-PLUS
			let appOpenParam = plus.runtime.arguments || 0
			if (appOpenParam) {
				let params = JSON.stringify(appOpenParam);
				let parsOne = params.substring(params.indexOf('one-') + 4, params.lastIndexOf('//'));
				if (params.indexOf('one-') > -1) {
					this.getVoteList(parsOne);
				}
			}
			//#endif
			
			
			//防重提
			getPostTokenFn()
		},

		mounted() {
			// this.$refs.popup.open()
		},
		methods: {
			haveRead(item) {
				this.$request.api.addSeeRecord({
					user_id: uni.getStorageSync('rawData').userId,
					pid: item.id,
					type: item.type
				}).then(res => {

					console.log('应该去红点')
					item.popUp = false
					this.getReddot()
				})

			},
			checkboxGrou(item) {
				this.$set(item, popUp, false)
				console.log(this.notifyList)
			},
			popupNotification() {
				let params = {
					pro_id: uni.getStorageSync('projectItem').proId,
					user_id: uni.getStorageSync('rawData').userId,
					owner_id: uni.getStorageSync('projectItem').ownerId,
					type: 2
				}
				this.$request.api.Notification(params).then(res => {
					// let inform = document.getElementById('inform')
					// console.log('informinforminform', inform)
					if (res.data.data.cdoList.length > 0) {
						this.notifyList = res.data.data.cdoList
					}

				})
			},
			//表决大会附议弹窗数据获取
			getVoteList(parsOne) {
				console.log("taylorswift")
				//弹框真的一个投票只打开一次
				if (uni.getStorageSync('openVoteId')) {
					if (uni.getStorageSync('openVoteId') == parsOne) {
						return;
					}
				}
				uni.setStorageSync('openVoteId', parsOne)
				let that = this;
				console.log("asdasd")
				this.$requestYz.api.getOwerVote({
					id: parsOne
				}).then(res => {
					this.voteData = res.data.data.voteUserDate
					setTimeout(() => {
						this.$refs.popup.open()
					}, 1000)
				})
			},
			updateVote() {
				this.$request.api.getAdduserData({
					essential_information_id: this.voteData.id,
					user_id: this.user_id,
				}).then(res => {
					uni.navigateTo({
						url: "/pages/vote/voteIndex?id=" + this.voteData.id
					})
				})

			},
			scanFun() {
				// 允许从相机和相册扫码
				uni.scanCode({
					success: function(res) {
						let obj = res
						let a = obj.result
						let index = a.indexOf("=")
						let id = obj.result.substring(index + 1)
						const str = id;
						const type = str.split('&type=')
						const typeNum = type[1];
						console.log(typeNum)
						if (typeNum == 1) {
							const str2 = id;
							// console.log(str2)
							const arr = str2.split('&type=');
							const num = arr[0];
							// const typeU = arr2[1];
							if (res.scanType == 'QR_CODE') {
								uni.navigateTo({
									url: '/pages/index/saoma?id=' + num
								})
							}
						}
						if (typeNum == 2) {
							const str1 = id;
							const arr1 = str1.split('&lng=');
							const num1 = arr1[0];
							const lnge1 = arr1[1];
							const str2 = lnge1;
							const arr2 = str2.split('&type=');
							const num2 = arr2[0];
							const type2 = arr2[1];
							if (res.scanType == 'QR_CODE') {
								uni.navigateTo({
									url: '/pages/index/h5patrol?lat=' + num1 + '&lng=' + num2
								})
							}
						}

						if (typeNum == 3) {
							const str3 = id;
							const arr3 = str3.split('&type=');
							const num3 = arr3[0];
							const typeU1 = arr3[1];
							if (res.scanType == 'QR_CODE') {
								uni.navigateTo({
									url: '/pages/vote/voteIndex?id=' + num3
								})
							}
						}


					}
				})
			},
			//去附议
			goFy() {
				this.$refs.popup.close()
				uni.navigateTo({
					url: "/pages/vote/voteIndex?id=" + this.voteData.id
				})
				// this.updateVote();
			},
			checkBaseInfo() {
				var roomId = uni.getStorageSync('projectItem').roomId;
				var userId = uni.getStorageSync('rawData').userId;
				if (roomId) {
					this.room_id = roomId;
				}
				if (userId) {
					this.user_id = userId;
				}
				if (roomId && userId) {
					//业主登录过，且有认证的房间，走红点查询接口
					this.getPaymentRedDot()
					this.getReddot()

				}

			},
			//获取投票红点
			getVoteDots() {
				if (!this.user_id) {
					return;
				}
				this.$requestYz.api.getVoteRedDotsInfo({
					userId: this.user_id
				}).then(res => {
					if (res.data.data) {
						this.voteRedsTotal = res.data.data.redDotsTotal
					}
				})
			},

			//红点
			async getReddot() {
				let hourseStr = uni.getStorageSync('projectItem')
				this.myPosition = hourseStr.buildDistrictCode + '-' + hourseStr.buildTowerCode + '-' +
					hourseStr.roomUnitNumber + '-' + hourseStr.roomCode
				uni.setStorageSync('myPosition', this.myPosition)

				let res = await this.$request.api.messageList({
					room_id: uni.getStorageSync('projectItem').roomId,
					user_id: uni.getStorageSync('rawData').userId,
					proId: uni.getStorageSync('projectItem').proId,
					notice_type: '业主端',
					roomNumber: this.myPosition
				});
				// 公告公示模块
				let objData = res.data.data;
				this.noticePoint = objData.noticeRedTotal || 0; //通知公告
				// 新增
				this.msgPoint = objData.chatRedTotal || 0; //底部消息红点
				// 日常模块  noticeRedTotal  insuranTotal renovation
				this.insuranTotal = objData.insuranTotal; //保险理赔
				this.renovation = objData.renovation; //装修管理
				// 新增
				this.repairsState = objData.repairsState || 0 //报修
				this.lawsuitRecord = objData.lawsuitRecord || 0; //诉讼记录
				this.openDoor = objData.openDoor || 0; //开门
				this.monitoring = objData.monitoring || 0; //监控查询
				this.publicity = objData.workRedTotal || 0; //工作公示
				this.indexPoint = this.noticePoint + this.insuranTotal + this.renovation //底部首页图标红点
				if (this.indexPoint) {
					//tabBar 首页图标
					uni.setTabBarBadge({ //显示数字
						index: 0,
						text: this.indexPoint + ''
					})
				} else {
					uni.removeTabBarBadge({
						index: 0
					})
				}
				//存在渲染，不存在去除
				if (this.msgPoint) {
					uni.setTabBarBadge({ //显示数字
						index: 1,
						text: this.msgPoint + ''
					})
				} else {
					uni.removeTabBarBadge({
						index: 1
					})
				}
			},

			async getPaymentRedDot() {
				let res = await this.$request.api.paymentRed({
					room_id: this.room_id,
					user_id: this.user_id,
				});
				console.log(res.data.data)
				for (let key in res.data.data) {
					if (res.data.data[key] == 0)
						this.num += 1
				}
				this.propertyFees = res.data.data.propertyFees;
				this.water = res.data.data.water;
				this.parkingSpaceFees = res.data.data.parkingSpaceFees
				this.repairFees = res.data.data.repairFees
				this.heatingCosts = res.data.data.heatingCosts
				this.refrigerationCharges = res.data.data.refrigerationCharges;
				this.electricity = res.data.data.electricity;
				console.log(this.parkingSpaceFees, "sadsadsad")
			},
			//轮播图第二张有下载按钮
			autoTime() {
				let odd = 1;
				setInterval(() => {
					odd++;
					if (odd % 2 == 0) {
						this.isDown = true;
					} else {
						this.isDown = false;
					}
				}, 5000);
			},
			//获取openId
			login() {
				let _this = this;
				// 检查登录状态是否过期

			},
			//通知列表
			noticeListFun() {
				uni.navigateTo({
					url: '/pages/authentication/newNoticeList'
				})
			},
			//获取房屋信息
			async getHouseList() {
				let data = await this.$request.api.getUserAndRoom({
					user_id: uni.getStorageSync('rawData').userId,
					phone: uni.getStorageSync('phone'),
					user_name: uni.getStorageSync('rawData').userName,
				})
				// console.log(data)
				let res = await this.$request.api.house({
					mobile: uni.getStorageSync('phone')
				})
				console.log('==-===========---------', res)
				//查询是否存在自己租的房屋
				let res2 = await this.$request.api.getProByMobile({
					mobile: uni.getStorageSync('phone') || this.phone
				})
				console.log(res2)
				if (res.data.data.projectList.length > 0) {
					this.hourseList = res.data.data.projectList
					this.hourseStr = this.hourseList[this.hourseNum]
					if (!uni.getStorageSync('hourseList')) {
						uni.setStorageSync('hourseList', res.data.data.projectList)
					}
					if (!uni.getStorageSync('projectItem')) {
						uni.setStorageSync('projectItem', res.data.data.projectList[0])
						this.projectItem = uni.getStorageSync('projectItem');
					} else {
						this.projectItem = uni.getStorageSync('projectItem');
					}
					this.housingFlag = true
					this.modalShow = false
				} else if (res2.data.data.projectList.length > 0) {
					this.hourseList = res2.data.data.projectList
					this.hourseStr = this.hourseList[this.hourseNum]
					if (!uni.getStorageSync('hourseList')) {
						uni.setStorageSync('hourseList', res2.data.data.projectList)
					}

					if (!uni.getStorageSync('projectItem')) {
						uni.setStorageSync('projectItem', res2.data.data.projectList[0])
						this.projectItem = uni.getStorageSync('projectItem');
					} else {
						this.projectItem = uni.getStorageSync('projectItem');
					}
					this.housingFlag = true
					this.modalShow = false
				} else if (res.data.data.projectList.length == 0) {
					this.housingFlag = false
					this.modalShow = false
					uni.removeStorageSync('hourseList')
					this.$openInvite()
				} else {
					this.housingFlag = false
					this.modalShow = true
				}
			},
			//newNotice 通知接口
			async getNewNotice() {
				let res = await this.$request.api.newNotice({
					// user_id: uni.getStorageSync('rawData').userId,
					notice_type: '业主端', //查询类型    助业网，员工端 业主端
					pageIndex: 1,
					room_id: uni.getStorageSync('projectItem').roomId,
					proId: uni.getStorageSync('projectItem').proId,
					result: ''
				});
				let nList = res.data.data.datalist || [];
				console.log('{{{{{{{Sdfsssss}}}}}}}', res)
				if (res.data.data) {
					this.isNotice = res.data.data.redNum;

				}
				console.log('res.data.data.readState=========', res)
				console.log('res.data.data.readState=========', res.data.data.readState, '======', this.isNotice)
				nList.forEach((item, index) => {
					this.noticeList.push((index + 1) + " " + item.notice_name + " ");
				})
			},
			//通知公告接口
			async getannouData() {
				return;
				this.noticeList = [];
				let res = await this.$request.api.Notice({
					My_user_id: uni.getStorageSync('rawData').userId,
					pageIndex: 1
				})
				if (this.pageIndex == 1) {
					this.annouArr = res.data.data.datalist || [];
				} else {
					this.annouArr = [...this.annouArr, ...res.data.data.datalist];
				}
				console.log(this.annouArr, '---通知列表')
				this.annouArr.forEach((item, index) => {
					this.noticeList.push((index + 1) + " " + item.notice_name + " ");
				})
				this.nextPage = res.data.data.isEndPage
				this.loading = true;
				uni.hideLoading();
			},
			//跳转更多
			moreItem(id) {
				//'/pages/index/indextow',3
				let par = '';
				if (id == 1) {
					par = 2;
				}
				if (id == 2) {
					par = 1;
				}
				if (id == 3) {
					par = 3;
				}
				uni.navigateTo({
					url: '/pages/index/indextow' + "?type=" + par
				})
			},
			newly() {
				uni.navigateTo({
					url: '/pages/information/informationindex'
				})
			},
			notice() {
				uni.navigateTo({
					url: '/pages/authentication/authentication'
				})
			},
			//淘宝链接
			toLink(index) {
				if (index == 0) {
					var link = 'https://m.tb.cn/h.UdLZXMw?tk=15H92yBCDzR'
					this.$request.api.getBookLink({}).then(res => {
						link = res.data.data.link
						// #ifdef H5
						window.open(
							link
						)
						// #endif
						// #ifdef APP-PLUS
						plus.runtime.openURL(
							link,
							function(res) {
								console.log(res);
							});
						// #endif
					})
				} else if (index == 1) {

					// #ifdef APP-PLUS
					var name = "uni.UNI21DD88C"; //助业网 app
					let appurl = "market://details?id=" + name;
					plus.runtime.openURL(appurl); //该代码仅在app中生效
					// #endif
					// #ifdef H5
					uni.request({
						url: 'https://admin.515f.com/api/rest/v1/venusSysAppUpgradeService/getNewAppInfoByType',
						method: 'POST',
						data: {
							app_type: 0
						},
						success: res => {
							this.info = res.data.data;
							window.location.href = this.info.wgt_link;
							// location.href = this.info.android_link;
						}
					})
					//该代码仅在h5中生效
					// #endif
				} else if (index == 2) {

					// #ifdef APP-PLUS
					var name = "uni.UNI531402B"; //员工端 app
					let appurl = "market://details?id=" + name;
					plus.runtime.openURL(appurl);
					// #endif
					// #ifdef H5
					uni.request({
						url: 'https://admin.515f.com/api/rest/v1/venusSysAppUpgradeService/getNewAppInfoByType',
						method: 'POST',
						data: {
							app_type: 1
						},
						success: res => {
							this.info = res.data.data;
							window.location.href = this.info.wgt_link;
							// location.href = this.info.android_link;
						}
					})
					// #endif
				}
				//	=== 添加下载记录
				if (index != 0) {
					//   `app_type` varchar(255) DEFAULT NULL COMMENT 'app类型:1.助业app 2.员工app 3.业主app',
					this.$request.api.appDownloads({
						org_id: uni.getStorageSync('projectItem').orgId,
						user_id: uni.getStorageSync('rawData').userId,
						user_roles: 1, //前端默认为1 代表用户 如果 user_id 为空为游客
						app_type: index
					}).then(res => {

					})
				}

			},
			// 金刚区切换
			tapName(item) {
				(item.index == 1 || item.index == 2) && this.$Router.pushTab({
					path: item.link
				})
				if (item.link) {
					uni.navigateTo({
						url: item.link
					})
				} else {
					console.log("Dsadsa")
					uni.showToast({
						icon: 'none',
						title: '该小区《物业管理中心》未将该门禁/监控设备接入本系统，暂时不能使用。'
					})
				}

			},
			// 切换房屋
			estate() {
				this.$Router.push({
					path: '/pages/switch/switch'
				})
			},
			// 业主认证
			renBtn() {
				let _this = this;
				if (uni.getStorageSync('phone')) {
					if (uni.getStorageSync('loginFlag')) {
						_this.$Router.push({
							path: '/pages/address/address'
						})
					} else {
						uni.showModal({
							title: '请先实名认证',
							showCancel: false,
							confirmText: '确认',
							confirmColor: '#F9A832',
							success: function(res) {
								if (res.confirm) {
									_this.$Router.push({
										path: '/pages/realName/realName'
									})
								}
							}
						});
					}
				} else {
					uni.showModal({
						title: '请先登录',
						showCancel: false,
						confirmText: '确认',
						confirmColor: '#F9A832',
						success: function(res) {
							if (res.confirm) {
								console.log('a')
								_this.$Router.pushTab({
									path: '/pages/user/user'
								})
							}
						}
					});
				}
			},
			//弹窗
			dd() {
				console.log(this.bol)
				this.bol = !this.bol
			},
			cancel() {
				console.log(this.bol)
				this.bol = !this.bol
			},
			handlerAdd(item) {
				uni.setStorageSync('projectItem', item)
				this.projectItem = uni.getStorageSync('projectItem');
				this.modalShow = false
			},
			handlerXZ() {
				let _this = this;
				if (uni.getStorageSync('phone')) {
					if (uni.getStorageSync('loginFlag')) {
						this.modalShow = true
					} else {
						uni.showModal({
							title: '请先实名认证',
							showCancel: false,
							confirmText: '确认',
							confirmColor: '#F9A832',
							success: function(res) {
								if (res.confirm) {
									_this.$Router.push({
										path: '/pages/realName/realName'
									})
								}
							}
						});
					}
				} else {
					uni.showModal({
						title: '请先登录',
						showCancel: false,
						confirmText: '确认',
						confirmColor: '#F9A832',
						success: function(res) {
							if (res.confirm) {
								console.log('a')
								_this.$Router.pushTab({
									path: '/pages/user/user'
								})
							}
						}
					});
				}
			},
			//关闭发起附议
			closeTip() {
				this.isMeeting = false;
			},
			//头部快速切换房间，跳转至切换房间页面
			changeHead() {
				//已经根据是否有房间信息展示切换图标了，无需在此处判断是否登录及有房间信息

				// this.$Router.push({
				// 	path: '/switch/switch'
				// })
				uni.navigateTo({
					url: '/pages/switch/switch'
				})


				// let _this = this;
				// if (uni.getStorageSync('phone')) {
				// 	if (uni.getStorageSync('loginFlag')) {
				// 		this.modalShow = true
				// 	} else {
				// 		uni.showModal({
				// 			title: '请先实名认证',
				// 			showCancel: false,
				// 			confirmText: '确认',
				// 			confirmColor: '#F9A832',
				// 			success: function(res) {
				// 				if (res.confirm) {
				// 					_this.$Router.push({
				// 						path: '/pages/realName/realName'
				// 					})
				// 				}
				// 			}
				// 		});
				// 	}
				// } else {
				// 	uni.showModal({
				// 		title: '请先登录',
				// 		showCancel: false,
				// 		confirmText: '确认',
				// 		confirmColor: '#F9A832',
				// 		success: function(res) {
				// 			if (res.confirm) {
				// 				console.log('a')
				// 				_this.$Router.pushTab({
				// 					path: '/pages/user/user'
				// 				})
				// 			}
				// 		}
				// 	});
				// }
			}
		}
	}
</script>
<style lang="scss">
	.page {
		background: #f4f4f4;
	}

	// ::v-deep uni-popup__wrapper{
	// 	width: 90%;
	// 	border-radius: 20rpx;
	// }
	.title_header {
		padding-bottom: 20rpx;
		text-align: center;
		color: #000;
		margin-bottom: 10px;
		font-size: 16px;
		font-weight: 700;
		width: 100%;
		border-bottom: 2rpx solid #ccc;
		// background: #19be6b;
	}

	//附议弹框
	.meeting-dialog {
		position: relative;

		::v-deep .u-mode-center-box {
			width: 670rpx !important;
			height: 800rpx;
			background: #FFFFFF !important;
			border-radius: 12rpx !important;
		}

		.meeting-wrap {
			padding: 40rpx;
			width: 700rpx;
			border-radius: 26rpx;
		}

		.meeting-title {
			text-align: center;
			font-size: 18px;
			font-weight: bold;
			padding-bottom: 20px;
			border-bottom: 1px solid #E7ECE1;
		}

		.meeting-start {
			margin: 40rpx 0 24rpx;
			font-size: 16px;
			font-weight: bold;
		}

		.meeting-cont {
			color: #333;
			font-size: 28rpx;
			border-bottom: 60rpx;
		}

		.meeting-btn {
			width: 350rpx;
			height: 88rpx;
			line-height: 88rpx;
			background: #FFFFFF;
			border-radius: 22px;
			border: 1px solid #427705;
			text-align: center;
			color: #427705;
			margin: 40px auto;
		}
	}

	.meeting-close {
		position: absolute;
		z-index: 999;
		margin-top: 370px;
		margin: 370px auto;
		left: 42%;
	}

	.meeting-close-btn {
		width: 80rpx;
		height: 80rpx;
	}
</style>
<style lang="scss" scoped>
	page {
		background-color: #f4f4f4;
	}

	//::v-deep 覆盖样式
	::v-deep .u-notice-bar {
		padding: 0 0rpx !important;
		background: transparent !important;
	}

	::v-deep .u-notice-content {
		color: #447A05 !important;
		font-weight: 600;
	}

	::v-deep uni-image>div,
	uni-image>img {
		position: absolute !important;
	}

	::v-deep uni-swiper {
		height: 280rpx !important;
	}

	.a .swiper_img {
		width: 100%;
		height: 140px;
		box-shadow: 0px 6px 20px 0px rgba(155, 155, 155, 0.5);
	}

	.newIndex {
		height: 100vh;
		background: #f4f4f4;
		overflow: hidden;

		.top-bg {
			width: 100%;
			height: 560rpx;
			// background: linear-gradient(180deg, #447A05 0%, #f4f4f4 100%);
			background-image: url('../../static/image/sybjt.png');
			background-size: 100% 100%;
			border-radius: 10px 10px 0 0;
			box-shadow:5px 2px 2px 1px #fdfefd, 8px 4px 3px 2px #f4f4f4;
			opacity: 1;
		}

		.wrap {
			padding: 80rpx 30rpx 0;
			position: relative;
			height: auto;

			.index-top {
				display: flex;
				align-items: center;
				justify-content: space-between;

				.icon {
					width: 82rpx;
					height: 82rpx;
					vertical-align: -28rpx;
					margin-right: 10rpx;
				}

				.txt {
					font-size: 42rpx;
					font-weight: 600;
					color: #FFFFFF;
				}
			}

			.noticeWrap {
				display: flex;
				justify-content: space-between;
				align-items: center;
			}

			.notice {
				width: 600rpx;
				height: 88rpx;
				background: #E7ECE1;
				border-radius: 44rpx;
				margin: 6rpx 0 12rpx;

				.notice-horn {
					position: relative;
					line-height: 88rpx;
					margin-left: 28rpx;
				}

				.horn {
					width: 36rpx;
					height: 32rpx;
					line-height: 88rpx;
					vertical-align: middle;
					margin-right: 24rpx;
					margin-top: -8rpx;
				}

				.circle {
					background: red;
					width: 12rpx;
					height: 12rpx;
					position: absolute;
					top: 20rpx;
					left: 20rpx;
					border-radius: 50%;
				}

				.scroll-txt {
					font-weight: 500;
					color: #447A05;
					font-size: 14px;
					position: absolute;
					left: 40rpx;
					right: 32rpx;
					height: 88rpx;
				}
			}

			.swiper {
				margin-top: 20rpx;
			}

			.item {
				position: relative;
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-top: 40rpx;

				.title {
					font-size: 34rpx;
					font-weight: bold;
					z-index: 1;
				}

				.title::before {
					content: "";
					position: absolute;
					width: 80px;
					height: 4px;
					background: linear-gradient(270deg, #F4FEE9 0%, #9CE14D 100%);
					border-radius: 3px;
					top: 42rpx;
					z-index: -1;
				}

				.more {
					font-size: 28rpx;
					color: #999;

					.more-img {
						width: 24rpx;
						height: 20rpx;
						vertical-align: middle;
					}
				}
			}

			.application {
				width: 100%;
				height: 220rpx;
				margin: 20rpx 0 0rpx 0;
				background: #ffffff;
				border-radius: 12px;
				display: flex;
				align-items: center;
				flex-wrap: nowrap;
				width: 100%;
				overflow: auto;

				.block {
					display: flex;
					justify-content: space-around;
					align-items: center;
					padding: 10rpx 20rpx;
					margin-top: -52rpx;

					.app {
						width: 140rpx;
						height: 100rpx;
						margin-right: 30rpx;
						text-align: center;
					}

					.app-img {
						width: 96rpx;
						height: 96rpx;
					}

					.circle1 {
						min-width: 30rpx !important;
						height: 30rpx;
						line-height: 30rpx;
						border-radius: 15rpx;
						padding: 0 8rpx;
						font-size: 12px;
						text-align: center;
						margin-right: 10px;
						position: absolute;
						right: -8rpx;
						color: #FFFFFF;
						background-color: #FF3B30;
						box-sizing: border-box;
					}

					.txt {
						font-size: 32rpx;
						color: #666;
					}
				}
			}
		}

		.u-notice-bar {
			padding: 0 !important;
			background: #fff !important;
		}

		.modal-bg {
			width: 100%;
			height: 100vh;
			position: fixed;
			top: 0;
			left: 0;
			bottom: 0;
			z-index: 999;
			background: rgba(0, 0, 0, 0.3);
		}

		.modal-cont {
			// height: 266rpx;
			background: #ffffff;
			// box-shadow: 0rpx 6rpx 12rpx 0rpx rgba(0, 0, 0, 0.12);
			border-radius: 24rpx 24rpx 0px 0rpx;
			position: fixed;
			right: 0;
			left: 0;
			bottom: 0;
			z-index: 1000;
		}

		.modal-text {
			font-size: 32rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #333333;
			text-align: center;
			height: 118rpx;
			line-height: 118rpx;
			border-bottom: 1rpx solid #e6e9ed;
		}

		.modal-cancel {
			height: 120rpx;
			line-height: 120rpx;
			text-align: center;
			font-size: 32rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #447A05;
		}

		.down__Owner_App {
			position: relative;
		}

		.down_cont_btn {
			position: absolute;
			width: 180rpx;
			height: 60rpx;
			left: 20rpx;
			top: -100rpx;
		}

		.u-btn {
			width: 100%;
			height: 100%;
		}
	}

	.red {
		position: absolute;
		top: -10rpx;
		height: 30rpx;
		line-height: 30rpx;
		border-radius: 16rpx;
		min-width: 30rpx;
		padding: 0 6rpx;
		font-size: 12px;
		text-align: center;
		margin-right: 10px;
		color: #FFFFFF;
		background-color: #FF3B30;
		box-sizing: border-box;
	}

	.red_min {
		position: absolute;
		top: 6rpx;
		right: 12rpx;
		width: 20rpx;
		height: 20rpx;
		border-radius: 10rpx;
		background-color: #FF3B30;
	}

	.publicity {
		width: 28rpx;
		height: 28rpx;
		border-radius: 50%;
		color: #fff;
		font-size: 24rpx;
	}
</style>